package framework.apache.common.codec.Hex;
import java.io.UnsupportedEncodingException;

import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
public class HexDemo {
	private static String encodeHexTest(String str) {
		try {
			str = Hex.encodeHexString(str.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		System.out.println("Hex 编码后：" + str);
		return str;
	}
	private static String decodeHexTest(String str) {
		Hex hex = new Hex();
		try {
			str = new String((byte[]) hex.decode(str));
		} catch (DecoderException e) {
			e.printStackTrace();
		}
		System.out.println("Hex 编码后：" + str);
		return str;
	}
}
